<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<link rel="stylesheet"
	href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" />

<!-- Optional theme -->
<link rel="stylesheet"
	href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css" />

<!-- Latest compiled and minified JavaScript -->
<script
	src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>

<title>ES config</title>
</head>
<body>
	<div class="container">
		<h1>Configure blocks for expert system</h1>
		<form:form method="POST" commandName="es"
			action="${pageContext.request.contextPath}/es/blocks-inputs">
			<input type="hidden" id="esId" name="esId" value="${esId}"/>
			<input type="hidden" id="layersId" name="layersId" value="${layersId}"/>
			<c:set var="index" value="${0}" scope="page"/>
			<c:forEach var="i" begin="0" end="${es.count - 1}">
				Layer ${i+1} 
				<table>
				<tbody>
					<c:forEach var="j" begin="0" end="${es.countOfBloks[i] - 1}">
						<tr>
							<td>Block ${j+1}  name:</td>
							<td><form:input path="blocks[${index }].name" /></td>
							<td><form:errors path="blocks[${index }].name"
									cssStyle="color: red;" /></td>
						</tr>
						<tr>
							<td>Block ${j+1} count of inputs:</td>
							<td><form:input path="blocks[${index }].countOfInputs" /></td>
							<td><form:errors path="blocks[${index }].countOfInputs"
									cssStyle="color: red;" /></td>
						</tr>
						<c:set var="index" value="${index + 1}" scope="page"/>
					</c:forEach>
				</tbody>
			</table>
			<br />
			</c:forEach>
			<input type="submit" value="Save" class="btn btn-default" />
		</form:form>
		<a href="${pageContext.request.contextPath}/">Home page</a>
	</div>
</body>
</html>